From df642feb9c487e6a43c2e197a9554aa71cd3c672 Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 7 Feb 2003 08:22:18 +0000 Subject: [PATCH] Convert duplicate, csv to use new arg scheme. Fix formatting in vecs. --- csv.c | 9 +++++++-- duplicate.c | 27 ++++++++++++++++----------- vecs.c | 2 +- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/csv.c b/csv.c index 4302bb079..cfc241d3f 100644 --- a/csv.c +++ b/csv.c @@ -29,6 +29,12 @@ static FILE *file_out; static void *mkshort_handle; static char *psn; +static +arglist_t csv_args[] = { + {"prefer_shortname", &psn, "Use shortnames even when we have longer names available"}, + {0, 0, 0} +}; + #define MYNAME "CSV" static void @@ -54,8 +60,6 @@ wr_init(const char *fname, const char *args) { file_out = fopen(fname, "w"); - psn = get_option(args, "prefer_shortname"); - if (file_out == NULL) { fatal(MYNAME ": Cannot open %s for writing\n", fname); } @@ -194,4 +198,5 @@ ff_vecs_t xmap_vecs = { xmap_wr_deinit, data_read, data_write, + csv_args }; diff --git a/duplicate.c b/duplicate.c index a5578404f..5b53acc2a 100644 --- a/duplicate.c +++ b/duplicate.c @@ -25,6 +25,16 @@ extern queue waypt_head; static int duplicate_shortname = 0; static int duplicate_location = 0; +char *snopt; +char *lcopt; + +static +arglist_t dup_args[] = { + {"shortname", &snopt, "Suppress duplicate waypoints based on name"}, + {"location", &lcopt, "Suppress duplicate waypoint based on coords"}, + {0, 0, 0} +}; + typedef struct btree_node { struct btree_node *left, *right; @@ -181,22 +191,17 @@ duplicate_process(void) } void -duplicate_init(const char *args) { +duplicate_init(const char *args) +{ const char *p; - - p = get_option(args, "shortname"); - if (p) { - duplicate_shortname = 1; - } - p = get_option(args, "location"); - if (p) { - duplicate_location = 1; - } + duplicate_shortname = snopt != NULL; + duplicate_location = lcopt != NULL; } void -duplicate_deinit(void) { +duplicate_deinit(void) +{ } filter_vecs_t duplicate_vecs = { diff --git a/vecs.c b/vecs.c index 14a541f77..6e4a3f2d6 100644 --- a/vecs.c +++ b/vecs.c @@ -315,7 +315,7 @@ disp_vecs(void) printf(" %-20.20s %-50.50s\n", vec->name, vec->desc); for (ap = vec->vec->args; ap && ap->argstring; ap++) { - printf(" %-10.10s %-40.40s\n", + printf(" %-18.18s %-50.50s\n", ap->argstring, ap->helpstring); } } -- 2.30.2